/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aaron.platform.entity;

import com.aaron.platform.view.FacesUtil;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
/**
 * 驻地网零星扩容工程信息
 * @author chenzhuohua
 */
@Entity
@Table(name = "zdw_lxkr_info")
@SequenceGenerator(name="ZDW_LXKR_ROJECT_GENERATOR", sequenceName="ZDW_LXKR_ROJECT_GENERATOR", allocationSize = 1)
public class ZdwLxkrProjectInfo extends BaseObject implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    public static final String LXKR_PROJECT_ID = "lxkrProjectId";
    
    public static final String RESIDENCE_NAME = "residenceName";
    
    public static final String CREATE_USER_NAME = "createUserName";
    
    public static final String DOMAIN_ID = "domainInfo.domainId";
    
    public static final String ENTERPRISE_ID = "enterpriseInfo.enterpriseId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="ZDW_LXKR_ROJECT_GENERATOR")
    @Column(name = "pro_id")
    private Integer lxkrProjectId;
    
    /** 专业 */
    @Column(name = "order_pro")
    private int orderPro;
    
    /** 小区名称 */
    @Column(name = "residence_name")
    private String residenceName;
    
    /** 原覆盖类型（FTTH/FTTB/ADSL) */
    @Column(name = "cover_type")
    private int coverType;
    
    /** 扩容或者覆盖 */
    @Column(name = "advance_type")
    private int advanceType;
    
    /** 需扩容DP盒数量 */
    @Column(name = "dp_quantity")
    private int dpQuantity;
    
    /** 需扩容网络箱数量 */
    @Column(name = "wlx_quantity")
    private int wlxQuantity;
    
    /** 扩容方案描述 */
    @Column(name = "expansion_scope")
    private String expansionScope;
    
    /** 扩容户数 */
    @Column(name = "expansion_quantity")
    private int expansionQuantity;
    
    /** 材料列表 */
    @OneToMany(mappedBy = "lxkrProjectInfo",fetch = FetchType.LAZY)
    @Cascade (value = {CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN})
    @Fetch(FetchMode.SELECT)
    @JoinColumn(name = "pro_id")
    private List<ZdwLxkrProjectMaterial> lxkrProjectMaterials;
    
    /** 预计投资（万元） */
    @Column(name = "estimated_invest")
    private double estimatedInvest;
    
    /** 提出需求日期 */
    @Column(name = "to_require_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date toRequireDate;
    
    /** 市场要求完成日期 */
    @Column(name = "to_done_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date toDoneDate;
    
    /** 实际扩容开工时间 */
    @Column(name = "start_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDate;
    
    /** 实际扩容完工时间 */
    @Column(name = "done_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date doneDate;
    
    /** 联系人 */
    @Column(name = "contact_name")
    private String contactName;
    
    /** 联系电话 */
    @Column(name = "contact_phone")
    private String contactPhone;
    
    /** 创建者姓名 */
    @Column(name = "create_user_name")
    private String createUserName;
    
    /** 对应的域信息 */
    @JoinColumn(name = "domain_id", referencedColumnName = "domain_id")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private ItscDomainInfo domainInfo;
    
    /** 对应的单位信息 */
    @JoinColumn(name = "enterprise_id", referencedColumnName = "enterprise_id")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private FgysEnterprise enterpriseInfo;

    public int getAdvanceType() {
        return advanceType;
    }

    public  String getDisplayAdvanceType() {
        switch (this.advanceType) {
            case 1:
                return FacesUtil.getString("list_item_zdw_kr");
            case 2:
                return FacesUtil.getString("list_item_zdw_fg");
            default:
                return FacesUtil.getString("list_item_default");
        }
    }
    
    public void setAdvanceType(int advanceType) {
        this.advanceType = advanceType;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public int getCoverType() {
        return coverType;
    }
    
    public String getDisplayCoverType() {
         switch (this.coverType) {
            case 1:
                return FacesUtil.getString("list_item_zdw_ftth");
            case 2:
                return FacesUtil.getString("list_item_zdw_fttb");
            case 3:
                return FacesUtil.getString("list_item_zdw_adsl");
            default:
                return FacesUtil.getString("list_item_default");
        }
    }

    public void setCoverType(int coverType) {
        this.coverType = coverType;
    }

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public ItscDomainInfo getDomainInfo() {
        return domainInfo;
    }

    public void setDomainInfo(ItscDomainInfo domainInfo) {
        this.domainInfo = domainInfo;
    }

    public Date getDoneDate() {
        return doneDate;
    }

    public void setDoneDate(Date doneDate) {
        this.doneDate = doneDate;
    }

    public FgysEnterprise getEnterpriseInfo() {
        return enterpriseInfo;
    }

    public void setEnterpriseInfo(FgysEnterprise enterpriseInfo) {
        this.enterpriseInfo = enterpriseInfo;
    }

    public double getEstimatedInvest() {
        return estimatedInvest;
    }

    public void setEstimatedInvest(double estimatedInvest) {
        this.estimatedInvest = estimatedInvest;
    }

    public String getExpansionScope() {
        return expansionScope;
    }

    public void setExpansionScope(String expansionScope) {
        this.expansionScope = expansionScope;
    }

    public Integer getLxkrProjectId() {
        return lxkrProjectId;
    }

    public void setLxkrProjectId(Integer lxkrProjectId) {
        this.lxkrProjectId = lxkrProjectId;
    }

    public int getOrderPro() {
        return orderPro;
    }

    public void setOrderPro(int orderPro) {
        this.orderPro = orderPro;
    }

    public String getResidenceName() {
        return residenceName;
    }

    public void setResidenceName(String residenceName) {
        this.residenceName = residenceName;
    }

    public int getDpQuantity() {
        return dpQuantity;
    }

    public void setDpQuantity(int dpQuantity) {
        this.dpQuantity = dpQuantity;
    }

    public int getWlxQuantity() {
        return wlxQuantity;
    }

    public void setWlxQuantity(int wlxQuantity) {
        this.wlxQuantity = wlxQuantity;
    }
    
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getToDoneDate() {
        return toDoneDate;
    }

    public void setToDoneDate(Date toDoneDate) {
        this.toDoneDate = toDoneDate;
    }

    public Date getToRequireDate() {
        return toRequireDate;
    }

    public void setToRequireDate(Date toRequireDate) {
        this.toRequireDate = toRequireDate;
    }

    public List<ZdwLxkrProjectMaterial> getLxkrProjectMaterials() {
        return lxkrProjectMaterials;
    }

    public void setLxkrProjectMaterials(List<ZdwLxkrProjectMaterial> lxkrProjectMaterials) {
        this.lxkrProjectMaterials = lxkrProjectMaterials;
    }

    public int getExpansionQuantity() {
        return expansionQuantity;
    }

    public void setExpansionQuantity(int expansionQuantity) {
        this.expansionQuantity = expansionQuantity;
    }
}
